<?php
session_start();
$currentuser=$_SESSION["user"];
$title=$_POST["title"];
$content=$_POST["content"];
$authorId=$currentuser["id"];
$author=$currentuser["username"];
$now=date_format(new DateTime(),'Y-m-d H:i:s');
$sql="INSERT INTO `bloginfo`(`title`,`content`,`authorId`,`author`,`createTime`,`updateTime`)
VALUES 
('$title','$content','$authorId,'$author','$now','$now')"; 
$conn=new mysqli("localhost",'root','','myphp');
$conn->query($sql);
if($conn->error) echo $conn->error;
else{
    echo"数据保存成功! <a href=''>查看</a>";
    // echo "登录成功<a href='article.php'>跳转</a>";
    
}
